package org.chen.pool;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

public class JedisPoolTest {
  public static void main(String[] args) {
    //创建连接池
    JedisPool jedisPool = new JedisPool("192.168.33.113",6379);
    //从连接池中获取jedis
    Jedis jedis =jedisPool.getResource();
    try {
      //测试连接
      System.out.println(jedis.ping());

      //jedis操作

    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if (jedis!=null){
        //关闭连接
        jedis.close();
      }
    }
  }
}
